package com.kuang.dao;

import com.kuang.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

// @Mapper
public interface UserMapper {
    @Select("select * from user")
    List<User> getUserList();

    // 方法存在多个参数，所有的参数前面必须加上@Param("id") 注解
    // User getUserById(@Param("参数名") 数据类型 参数名, @Param("参数名") 数据类型 参数名);
    @Select("select * from user where id = #{id}")
    User getUserById(@Param("id") int id);

    @Insert("insert into user(id,name,pwd) value (#{id},#{name},#{pwd})")
    int addUser(User user);

    @Update("update user set name = #{name},pwd = #{pwd} where id = #{id}")
    int updateUser(User user);


    @Delete("delete from user where id = #{id}")
    int deleteUser(@Param("id") int id);
}
